{% extends "layouts/application.html" %}
{% block content %}

<script type="text/javascript">
	function pageselectCallback(page_id, jq){
		//alert(page_id)
		//old_url = window.location;
		window.location.href=window.location+"&page="+(page_id+1);
    }
    $(document).ready(function(){
		// Create pagination element
        $("#Pagination").pagination({{objects.paginator.count}}, {
			num_edge_entries: 2,
			num_display_entries: 8,
			current_page:({{objects.number}}-1),
            callback: pageselectCallback
        });
    });
</script>
<div align="center">
  <DIV class=boxright>
    <DIV class=bltop2>
      <div align="left">
        <strong>&nbsp;&nbsp;&nbsp;当前位置：&nbsp;&nbsp;
          <a href="/{%site_root%}/resource/search/">资料查询</a>
        </strong>
      </div>
    </DIV>
    <DIV class=c_box>
      <DIV class="rep_left">
        <form name="form1" action="" method="get">
          <TABLE id=tblSearch  cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdp height=22 width="30%" ALIGN="left"><STRONG>搜索资料</STRONG></TD>
                <TD class=rtdp align="right" COLSPAN="2">
                <input id="searchStr" type="text" name="searchStr" style="WIDTH: 330px" class="text" >
                </TD>
                <TD class=rtdp width="48%" ALIGN="left">
                  <a href="#" onclick="funConfirm();">
                    <img alt="搜索" src="/site_media/images/search.png" width="28" height="25" border="0">
                  </a>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
        </form>
		<form name="form2" action="" method="get">
          <TABLE cellSpacing=0 cellPadding=4  width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdp height=22 COLSPAN="4" ALIGN="left"><STRONG>查询资料</STRONG></TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 width="15%" ALIGN="left">
                  &nbsp;
                </TD>
                <TD class=rep_li_c2 width="10%" align="left">
                  {{form.cata}}
                </TD>
                &nbsp;
                <TD class=rep_li_c2 width="10%" align="left">
 				  {{form.prefix_two}}
                </TD>
                <TD class=rep_li_c2 width="10%" ALIGN="left">
                  &nbsp;
                </TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 width="10%"></TD>
                <TD class=rep_li_c2 width="18%" ALIGN="left">{{form.prefix_three}}</TD>
                <TD class=rep_li_c2 width="18%" ALIGN="left">
                <select style="WIDTH: 150px" name="filetime">
                  	<option value="">--上传时间--</option>
                  	<option value="1">当天的</option>
                  	<option value="7">一周以内</option>
                  	<option value="30">1个月以内</option>
					<option value="90">3个月以内</option>
					<option value="180">6个月以内</option>
					<option value="360">1年以内</option>
					<option value="720">2年以内</option>
                  </select>
                </TD>
                <TD class=rep_li_c2 width="18%"></TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 colSpan=2 ALIGN="right">
                  <INPUT onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="" type=submit value="搜索" name="">

                </TD>
                <TD class=rep_li_c2 colSpan=2></TD>
              </TR>
            </TBODY>
          </TABLE>
			</form>
		<form id="search_modif" method="post">
          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <td><INPUT id="chkAll" onclick="title_check('chkAll','chkID[]')"  type="checkbox" value=checkbox></td>
                <TD class=rep_li_c width="10%"><STRONG>一级目录</STRONG></TD>
                <TD class=rep_li_c width="10%"><STRONG>二级目录</STRONG></TD>
                <TD class=rep_li_c width="30%"><STRONG>文件名</STRONG></TD>
                <TD class=rep_li_c width="2%"><STRONG>&nbsp;</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>上传人</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>大小</STRONG></TD>
                <TD class=rep_li_c width="15%"><STRONG>创建日期</STRONG></TD>
                <TD class=rep_li_c width="5%"><STRONG>&nbsp;</STRONG></TD>
              </TR>
              	{% if objects %}
              	共找到：{{objects.paginator.count}} 条记录
				{% for file in objects.object_list %}
                <TR id="tr_{{file.id}}" style="TEXT-DECORATION: none" onMouseOver="this.style.backgroundColor='#EFF8FF'" onmouseout="this.style.backgroundColor=''">
                  <TD class=rtdw2>
                    <INPUT onclick="rows_check('chkAll','chkID[]')" type=checkbox value="{{file.id}}" name="chkID[]">
                  </TD>
                  <TD class=rep_li_td_bt>
                  	{% if file.isNew %}
                  		<img src="/site_media/images/new.gif">
                  	{% endif %}
                  	{{file.cata.parentId}}
                  </TD>
                  <TD class=rep_li_td_bt>{{file.cata}}</TD>
                  <TD class=rep_li_td_bt align="left"><a href="{{file.getFile}}" target="_blank">【{{file.prefix_one}}】【{{file.prefix_two}}】【{{file.prefix_three}}】{{file.name}}</a></TD>
                  <TD class=rep_li_td_bt>
					{% if file.filepic%}
                    <a href="{{file.getImgPath}}" class="imagesview" ><img border="0" src="/site_media/images/picture1.png" height="16" width="16" alt="预览"></a>
                    {% endif %}
				  </TD>
                  <TD class=rep_li_td_bt>{{file.user.username}}</TD>
                  <TD class=rep_li_td_bt>{{file.size|filesizeformat}}</TD>
                  <TD class=rep_li_td_bt>{{file.datetime|date:"Y年n月j日h时i分"}}</TD>
                  <TD class=rep_li_td_bt>
                    <a href="{{file.getFilePath}}" target="_blank"><img src="/site_media/images/down_icon.png" border="0" height="16" width="16" alt="下载"></a>
                  </TD>
                </TR>
				{% endfor %}
				{% else %}
				<div align="center" style="color:red;margin-bottom:10px;">对不起！没有找到您要的搜索结果！</div>
				{% endif %}
            </TBODY>
          </TABLE>

          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD  align="center">

                </TD>
              </TR>
            </TBODY>
          </TABLE>
          <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR vAlign=top>
              <TR vAlign=top ALIGN="left">
                <TD>
                  <INPUT onclick="return check_select_one('chkAll','chkID[]','/{%site_root%}/manage/edit_file/')"
                         name="button" class="button" id="edit"  type="button" value="编辑文件">
                  <INPUT ONCLICK="return check_select('chkID[]','search_modif','/{%site_root%}/manage/trash_put/0');"
                         name="button" class="button" id="delete"   type="submit" value="放入回收站">
                  <INPUT ONCLICK="return check_select('chkID[]','search_modif','/{%site_root%}/manage/trash_del/0');"
                         name="button" class="button" id="destroy"  type="submit" value="彻底删除">

                </TD>
                <TD>
                <div id="Pagination" class="pagination">
                </TD>
              </TR>
            </TBODY>
          </TABLE>
		</form>
      </DIV>
    </DIV>
    <SCRIPT type="text/javascript">
        function showSearching(){
            $("#tblSearch").style.display="";
        }
        function hideSearching(){
            $("#reset").click();
            $("#tblSearch").style.display="none";
        }

        function funConfirm(){
            if($('#searchStr')==""){
                alert("请输入关键字!");
                $("#searchStr").focus();
                return false;
            }
            else {
                $("#form1").submit(); return true;
            }
        }
    </SCRIPT>
  </DIV>
  <div>
  </div>
</div>
{% endblock %}
